require "import"
import "tools"
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS).setStatusBarColor(0xff4DB6AC)
activity.setContentView("execute_")
exe.background=btBackground
exe. onClick=function()
  msg.text=""
  thread(exe,cmd.text)
end
function exe(command)
  require "import"
  import "java.io.*"
  local cmd=luajava.astable(String(tostring(activity.getFilesDir()).."/ffmpeg "..command).split(" "))
  local process=Runtime.getRuntime().exec(cmd)
  local err=BufferedReader(InputStreamReader(process.getErrorStream()))
  function readError(err)
    require "import"
    import "java.io.*"
    local info=""
    line=err.readLine()
    while line~=nil do
      info=info.."\n"..line
      line=err.readLine()
      call("back","progress",line)
    end
    call("back","done",info)
    this.quit()
  end
  thread(readError,err)
end
function back(b,a)
  if a~=nil
    msg.text=msg.text.."\n\n"..a
  end
end